import time

def sort(a):
    a1 = True
    while a1:
        a1 = False
        for i in range(len(a) - 1):
            if a[i] > a[i + 1]:
                a[i], a[i + 1] = a[i + 1], a[i]
                a1 = True

def read(a):
    file = open(a, 'r')
    data = file.readlines()
    return data

m1 = read("m1_sorted.txt")
m2 = read("m2_reverse.txt")
m3 = read("m3_shuffle.txt")

a1 = time.time()
sort(m1)
a2 = time.time()
print("m1_sorted",round((a2-a1)*1000),"milliseconds")

a1 = time.time()
sort(m2)
a2 = time.time()
print("m2_reverse",round((a2-a1)*1000),"milliseconds")

a1 = time.time()
sort(m3)
a2 = time.time()
print("m3_shuffle",round((a2-a1)*1000),"milliseconds")